package cn.wangsy.zhidao.p20170110;

public class PrintClockNumber {

	public static void main(String[] args) {
		print(1234567890);
		System.out.println();
		print1(520);
	}

	private static void print(int total){
		
		char[] charArray = String.valueOf(total).toCharArray();
		int length = charArray.length;
		
		/*
		System.out.println("****    * **** **** *  * **** **** **** **** ****");
		System.out.println("*  *    *    *    * *  * *    *       * *  * *  *");
		System.out.println("*  *    * **** **** **** **** ****    * **** ****");
		System.out.println("*  *    * *       *    *    * *  *    * *  *    *");
		System.out.println("****    * **** ****    * **** ****    * **** ****");*/
		
		String[][] strs = new String[5][5*length];
		
		for(int i=0;i<length;i++){
			int start = 5*i;
			//第一行
			switch (charArray[i]) {
			case '0':
			case '2':
			case '3':
			case '5':
			case '6':
			case '7':
			case '8':
			case '9':
				strs[0][start]="*";
				strs[0][start+1]="*";
				strs[0][start+2]="*";
				strs[0][start+3]="*";
				break;
			case '1':
				strs[0][start]=" ";
				strs[0][start+1]=" ";
				strs[0][start+2]=" ";
				strs[0][start+3]="*";
				break;
			case '4':
				strs[0][start]="*";
				strs[0][start+1]=" ";
				strs[0][start+2]=" ";
				strs[0][start+3]="*";
				break;
			default:
				break;
			}
			
			//第二行
			switch (charArray[i]) {
			case '0':
			case '4':
			case '8':
			case '9':
				strs[1][start]="*";
				strs[1][start+1]=" ";
				strs[1][start+2]=" ";
				strs[1][start+3]="*";
				break;
			case '1':
			case '2':
			case '3':
			case '7':
				strs[1][start]=" ";
				strs[1][start+1]=" ";
				strs[1][start+2]=" ";
				strs[1][start+3]="*";
				break;
			case '5':
			case '6':
				strs[1][start]="*";
				strs[1][start+1]=" ";
				strs[1][start+2]=" ";
				strs[1][start+3]=" ";
				break;
			}
			
			//第三行
			switch (charArray[i]) {
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '8':
			case '9':
				strs[2][start]="*";
				strs[2][start+1]="*";
				strs[2][start+2]="*";
				strs[2][start+3]="*";
				break;
			case '1':
			case '7':
				strs[2][start]=" ";
				strs[2][start+1]=" ";
				strs[2][start+2]=" ";
				strs[2][start+3]="*";
				break;
			case '0':
				strs[2][start]="*";
				strs[2][start+1]=" ";
				strs[2][start+2]=" ";
				strs[2][start+3]="*";
				break;
			default:
				break;
			}
			
			//第四行
			switch (charArray[i]) {
			case '0':
			case '6':
			case '8':
				strs[3][start]="*";
				strs[3][start+1]=" ";
				strs[3][start+2]=" ";
				strs[3][start+3]="*";
				break;
			case '1':
			case '3':
			case '4':
			case '5':
			case '7':
			case '9':
				strs[3][start]=" ";
				strs[3][start+1]=" ";
				strs[3][start+2]=" ";
				strs[3][start+3]="*";
				break;
			case '2':
				strs[3][start]="*";
				strs[3][start+1]=" ";
				strs[3][start+2]=" ";
				strs[3][start+3]=" ";
				break;
			default:
				break;
			}
			
			//第五行
			switch (charArray[i]) {
			case '0':
			case '2':
			case '3':
			case '5':
			case '6':
			case '8':
			case '9':
				strs[4][start]="*";
				strs[4][start+1]="*";
				strs[4][start+2]="*";
				strs[4][start+3]="*";
				break;
			case '1':
			case '4':
			case '7':
				strs[4][start]=" ";
				strs[4][start+1]=" ";
				strs[4][start+2]=" ";
				strs[4][start+3]="*";
				break;
			default:
				break;
			}
			
			strs[0][start+4]=" ";
			strs[1][start+4]=" ";
			strs[2][start+4]=" ";
			strs[3][start+4]=" ";
			strs[4][start+4]=" ";
		}
		
		for(int i=0;i<strs.length;i++){
			for(int j=0;j<strs[i].length;j++){
				System.out.print(strs[i][j]);
			}
			System.out.println();
		}
	}
	
	private static void print1(int total){
		
		char[] charArray = String.valueOf(total).toCharArray();
		int length = charArray.length;
		String[][] strs = new String[5][length];
		
		for(int i=0;i<length;i++){
			switch (charArray[i]) {
			case '0':
				strs[0][i]="****";
				strs[1][i]="*  *";
				strs[2][i]="*  *";
				strs[3][i]="*  *";
				strs[4][i]="****";
				break;
			case '1':
				strs[0][i]="   *";
				strs[1][i]="   *";
				strs[2][i]="   *";
				strs[3][i]="   *";
				strs[4][i]="   *";
				break;
			case '2':
				strs[0][i]="****";
				strs[1][i]="   *";
				strs[2][i]="****";
				strs[3][i]="*   ";
				strs[4][i]="****";
				break;
			case '3':
				strs[0][i]="****";
				strs[1][i]="   *";
				strs[2][i]="****";
				strs[3][i]="   *";
				strs[4][i]="****";
				break;
			case '4':
				strs[0][i]="*  *";
				strs[1][i]="*  *";
				strs[2][i]="****";
				strs[3][i]="   *";
				strs[4][i]="   *";
				break;
			case '5':
				strs[0][i]="****";
				strs[1][i]="*   ";
				strs[2][i]="****";
				strs[3][i]="   *";
				strs[4][i]="****";
				break;
			case '6':
				strs[0][i]="****";
				strs[1][i]="*   ";
				strs[2][i]="****";
				strs[3][i]="*  *";
				strs[4][i]="****";
				break;
			case '7':
				strs[0][i]="****";
				strs[1][i]="   *";
				strs[2][i]="   *";
				strs[3][i]="   *";
				strs[4][i]="   *";
				break;
			case '8':
				strs[0][i]="****";
				strs[1][i]="*  *";
				strs[2][i]="****";
				strs[3][i]="*  *";
				strs[4][i]="****";
				break;
			case '9':
				strs[0][i]="****";
				strs[1][i]="*  *";
				strs[2][i]="****";
				strs[3][i]="   *";
				strs[4][i]="****";
				break;
			default:
				break;
			}
			
		}
		
		for(int i=0;i<strs.length;i++){
			for(int j=0;j<strs[i].length;j++){
				System.out.print(strs[i][j]+" ");
			}
			System.out.println();
		}
		
	}
	
}
